package springbootyx.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import springbootyx.service.IUserService;
import springbootyx.entity.SimpleUser;
import springbootyx.entity.User;
import springbootyx.mapper.IUserMapper;

import java.util.List;


@Service

public class UserService implements IUserService {
    @Autowired
    private IUserMapper userMapper;

    //通过用户id获取用户信息
    @Override
    public User getUserById(Integer id) {
        userMapper.getUserById(id);
        return null;
    }


    //通过用户名和密码获取用户，该方法已废弃
    @Override
    public SimpleUser getUserByNamePwd(String name, String pwd) {
        return userMapper.getUserByNamePwd(name, pwd);
    }

    //通过用户id获取该用户的所有关注用户
    @Override
    public List<User> getMyFocus(int id) {
        return userMapper.getMyFocus(id);
    }

    @Override
    public List<User> getMyFans(int id) {
        return userMapper.getMyFans(id);
    }

    @Override
    public User login(String username, String password) {
        return userMapper.login(username, password);
    }

    @Override
    public void updateUser(int userid, String username, int age, String sex, String password, String email, String family, String intro) {
        userMapper.updateUser(userid, username, age, sex, password, email, family, intro);
    }

}
